package com.tdkj.action.backstage.risevalue;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.risevalue.BeanPlateQuotation;
import com.tdkj.service.risevalue.IBeanPlateQuotationService;


public class PlateQuotationAction extends BaseAction {
    
	private IBeanPlateQuotationService plateQuotationService;
	
	private long id;
	
	private String name;
	
	private List<BeanPlateQuotation> plates ;
	
	private BeanPlateQuotation plate ;
	
	private String message;
	
	public String add() {
		plate = new BeanPlateQuotation();
		plate.setName(name);
		
		plateQuotationService.add(plate);
		this.setMessage("添加成功");
		return execute();
	}
	
	public String update() {
		plateQuotationService.update(id, name);
		this.setMessage("保存成功");
		return execute();
	}

	public String del() {
		plateQuotationService.delete(id);
		this.setMessage("删除成功");
		return "delete";
	}
	
	public String edit() {
		plate = plateQuotationService.get(id);
		this.setMessage("获取成功");
		return "edit";
	}
	
	public String get() {
		plate = plateQuotationService.get(id);
		this.setMessage("获取成功");
		return "get";
	}
	
	public String execute() {
		plates = plateQuotationService.getAll();
		return "success";
	}
	

	@Resource
	public void setPlateService(IBeanPlateQuotationService plateQuotationService) {
		this.plateQuotationService = plateQuotationService;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * @param message the message to set
	 */
	public void setMessage(String message) {
		this.message = message;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the plates
	 */
	public List<BeanPlateQuotation> getPlates() {
		return plates;
	}

	/**
	 * @param plates the plates to set
	 */
	public void setPlates(List<BeanPlateQuotation> plates) {
		this.plates = plates;
	}

	/**
	 * @return the plate
	 */
	public BeanPlateQuotation getPlate() {
		return plate;
	}

	/**
	 * @param plate the plate to set
	 */
	public void setPlate(BeanPlateQuotation plate) {
		this.plate = plate;
	}

	
	
}
